// Package mgmt
// @Author: zhengqi Wu
// @Description:
// @Version: 1.0.0
// @Date: 2021/4/19 23:19 下午
// @Copyright: MIN-Group；国家重大科技基础设施——未来网络北大实验室；深圳市信息论与未来网络重点实验室
//
const aggregation = require('../common/aggregation')
const {ControlParameters} = require("../component/ControlParameters");
const {CommandBase, ManagementModuleFaceMgmt} = require("./CommandBase");

const LogicFaceManagementActionList = "list"
const LogicFaceManagementActionAdd = "add"
const LogicFaceManagementActionDel = "del"

class LogicFaceAddCommand extends aggregation(CommandBase){
    constructor() {
        super();
    }
}

/**
 * CreateLogicFaceAddCommand 创建一个 LogicFaceAddCommand 命令
 * @param topPrefix
 * @param parameters
 * @returns {LogicFaceAddCommand}
 */
function createLogicFaceAddCommand(topPrefix, parameters){
    let command = new LogicFaceAddCommand()
    command.setTopPrefix(topPrefix)
    command.setModuleName(ManagementModuleFaceMgmt)
    command.setAction(LogicFaceManagementActionAdd)
    command.setParameters(parameters)
    return command
}

class LogicFaceDelCommand extends aggregation(CommandBase){
    constructor() {
        super();
    }
}

/**
 * CreateLogicFaceDelCommand 创建一个 LogicFaceDelCommand 命令
 * @param topPrefix
 * @param id
 * @returns {LogicFaceAddCommand}
 */
function createLogicFaceDelCommand(topPrefix, id){
    let command = new LogicFaceAddCommand()
    command.setTopPrefix(topPrefix)
    command.setModuleName(ManagementModuleFaceMgmt)
    command.setAction(LogicFaceManagementActionDel)
    let parameters = new ControlParameters()
    parameters.setLogicFaceId(id)
    command.setParameters(parameters)
    return command
}

class LogicFaceListCommand extends aggregation(CommandBase){
    constructor() {
        super();
    }
}

/**
 * CreateLogicFaceListCommand 创建一个 LogicFaceListCommand 命令
 * @param topPrefix
 * @returns {LogicFaceAddCommand}
 */
function createLogicFaceListCommand(topPrefix){
    let command = new LogicFaceAddCommand()
    command.setTopPrefix(topPrefix)
    command.setModuleName(ManagementModuleFaceMgmt)
    command.setAction(LogicFaceManagementActionDel)
    let parameters = new ControlParameters()
    return command
}

module.exports={
    LogicFaceAddCommand:LogicFaceAddCommand,
    LogicFaceDelCommand:LogicFaceDelCommand,
    LogicFaceListCommand:LogicFaceListCommand,
    LogicFaceManagementActionAdd:LogicFaceManagementActionAdd,
    LogicFaceManagementActionDel:LogicFaceManagementActionDel,
    LogicFaceManagementActionList:LogicFaceManagementActionList,
    createLogicFaceAddCommand:createLogicFaceAddCommand,
    createLogicFaceDelCommand:createLogicFaceDelCommand,
    createLogicFaceListCommand:createLogicFaceListCommand
}